package com.lzy.cloud.gateway;

import com.lzy.cloud.gateway.filter.AccessFilter;
import com.lzy.cloud.gateway.filter.ErrorFilter;
import org.springframework.boot.Banner;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.boot.autoconfigure.jdbc.DataSourceAutoConfiguration;
import org.springframework.boot.autoconfigure.mongo.MongoAutoConfiguration;
import org.springframework.boot.builder.SpringApplicationBuilder;
import org.springframework.cloud.client.discovery.EnableDiscoveryClient;
import org.springframework.cloud.netflix.eureka.EnableEurekaClient;
import org.springframework.cloud.netflix.zuul.EnableZuulProxy;
import org.springframework.context.annotation.Bean;

@EnableDiscoveryClient
@SpringBootApplication(exclude = {DataSourceAutoConfiguration.class, MongoAutoConfiguration.class})
@EnableZuulProxy
@EnableEurekaClient
public class LzyCloudGatewayApplication {
    public static void main(String[] args) {
//        SpringApplication.run(LzyCloudGatewayApplication.class, args);
        new SpringApplicationBuilder(LzyCloudGatewayApplication.class).bannerMode(Banner.Mode.LOG).run(args);
    }

    @Bean
    public AccessFilter accessFilter() {
        return new AccessFilter();
    }

    @Bean
    public ErrorFilter errorFilter() {
        return new ErrorFilter();
    }
}
